package br.com.brasilprojetos;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class SpaceHero extends Activity implements OnClickListener {

	private final static int NEW_GAME = 0;
	private final static int OPTIONS = 1;
	private final static int RECORDS = 2;
	
	private Button btnNewGame;
	private Button btnOptions;
	private Button btnRecords;
	
	/** Called when the activity is first created . */
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    
	    //load the main layout
		setContentView(R.layout.main);
		
		//load the buttons
		btnNewGame = (Button) findViewById(R.id.btn_new_game);
		btnOptions = (Button) findViewById(R.id.btn_options);
		btnRecords = (Button) findViewById(R.id.btn_records);
		
		//incude the click listener in each button
		btnNewGame.setOnClickListener(this);
		btnOptions.setOnClickListener(this);
		btnRecords.setOnClickListener(this);
	}

	/**
	 * Manage the click in each button in the main screen
	 * */
	public void onClick(View v) {
		Intent i;
		//based in the item id call the right screen
		switch(v.getId()){
		case R.id.btn_new_game:
			i = new Intent(this, SpaceHeroGame.class);
			startActivity(i);
			break;
		case R.id.btn_options:
			i = new Intent(this, SpaceHeroOptions.class);
			startActivity(i);
			break;
		case R.id.btn_records:
			i = new Intent(this, SpaceHeroRecords.class);
			startActivity(i);
			break;
		}
		
	}

}
